//
//  CusotmTextView.m
//  XiaoBaiWang
//
//  Created by qiaofeng wu on 2017/10/28.
//  Copyright © 2017年 董振山. All rights reserved.
//

#import "CusotmTextView.h"
@interface CusotmTextView()
@end

@implementation CusotmTextView

- (void)drawRect:(CGRect)rect {
    NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
    attrs[NSFontAttributeName] = [UIFont systemFontOfSize:15];
    attrs[NSForegroundColorAttributeName] = [UIColor colorWithHexString:@"#cbcfd4"];
    
    [self.placeHolder drawInRect:CGRectMake(0, 9, self.width, self.height) withAttributes:attrs];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    [self setNeedsDisplay];
}

- (void)setPlaceHolder:(NSString *)placeHolder {
    _placeHolder = placeHolder;
    [self setNeedsDisplay];
}

- (void)setFont:(UIFont *)font {
    [super setFont:font];
    [self setNeedsDisplay];
}

- (void)setText:(NSString *)text {
    [super setText:text];
    
    if (text.length) {
        self.placeHolder = @"";
    }
    [self setNeedsDisplay];
}

- (void)setAttributedText:(NSAttributedString *)attributedText {
    [super setAttributedText:attributedText];
    if (attributedText.length) {
        self.placeHolder = @"";
    }
    [self setNeedsDisplay];
}
























@end
